package ArrayListTest;

import java.util.ArrayList;

public class Test5 {
    public static void main(String[] args) {

        ArrayList<Phone> list3 = new ArrayList<>();

        Phone a1 = new Phone("小米",1000);
        Phone a2 = new Phone("苹果",8000);
        Phone a3 = new Phone("锤子",2999);
        list3.add(a1);
        list3.add(a2);
        list3.add(a3);

        ArrayList<Phone> list5 = asd(list3);
        for(int i = 0 ; i < list5.size();i++){
            Phone c = list5.get(i);
            System.out.println(c.getBrandname()+", "+c.getPrice());
        }

    }

    public static ArrayList<Phone> asd(ArrayList<Phone> list3){
        ArrayList<Phone> list4 = new ArrayList<>();
       for(int i = 0 ; i<list3.size(); i++){
           Phone a = list3.get(i);
           if(a.getPrice()<3000){
               list4.add(a);
           }
       }
      return list4;

    }


}
